home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume2 / kernel / xoper12.1 < prev    next >
Internet Message Format  |  1988-10-29  |  49KB

  1. Path: xanth!nic.MR.NET!tank!ncar!mailrus!ulowell!page
  2. From: page@swan.ulowell.edu (Bob Page)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v02i035:  xoper - system operations info and control V1.2, Part01/02
  5. Message-ID: <9918@swan.ulowell.edu>
  6. Date: 29 Oct 88 00:12:27 GMT
  7. Organization: University of Lowell, Computer Science Dept.
  8. Lines: 1665
  9. Approved: page@swan.ulowell.edu
  10.  
  11. Submitted-by: g35@dhdurz1.bitnet (Guenther Werner)
  12. Posting-number: Volume 2, Issue 35
  13. Archive-name: kernel/xoper12.1
  14.  
  15. Xoper is a freeware program to display and to control system activity.
  16. New commands in V1.2: Snoop (mem), Capture, ClrCool, ClrWarm, ClrCold.
  17. Added CPU usage by task.
  18. Cancel command has been rewritten, some minor bugs removed.
  19.  
  20. [join Xoper.a1 and Xoper.a2 to get the complete source code.  ..Bob]
  21.  
  22. # This is a shell archive.  Remove anything before this line
  23. # then unpack it by saving it in a file and typing "sh file"
  24. # (Files unpacked will be owned by you and have default permissions).
  25. # This archive contains the following files:
  26. #    Xoper.a2
  27. #    Xoper.doc
  28. #
  29. if `test ! -s Xoper.a2`
  30. then
  31. echo "writing Xoper.a2"
  32. cat > Xoper.a2 << '\Rogue\Monster\'
  33.             bne.s   cleanit
  34.             move.b  #1,background
  35.             bsr     installh
  36. cleanit     tst.l   fileptr
  37.             beq.s   ib1
  38.             move.l  window(PC),a0
  39.             move.w  4(a0),window_l
  40.             move.w  6(a0),window_t
  41.             move.w  8(a0),window_w
  42.             move.w  10(a0),window_h
  43.             move.l  fileptr(PC),d1
  44.             CALL    Close,dosbase(PC)
  45.             clr.l   fileptr
  46. ib1         clr.b   running
  47.             move.l  mysignal(PC),d0
  48.             CALL    Wait,_SysBase(PC)
  49.             move.b  #1,running
  50.             bra     restart
  51.  
  52. ;fill all unused memory-chunks with a longword
  53. clear       bsr     readhex
  54.             tst.b   d7
  55.             beq     syntax
  56.             move.l  _SysBase(PC),a0
  57.             clr.l   parmtxt
  58.             lea     322(a0),a0
  59.             move.w  #$4000,$dff09a
  60. clr1        move.l  0(a0),a0
  61.             tst.l   0(a0)
  62.             beq.s   clr4
  63.             move.l  16(a0),a1
  64. clr2        tst.l   0(a1)
  65.             beq.s   clr1
  66.             add.l   #1,parmtxt
  67.             move.l  4(a1),d1
  68.             sub.l   #8,d1
  69.             beq.s   clr31
  70.             lsr.l   #2,d1
  71.             subq.l  #1,d1
  72.             lea     8(a1),a2
  73. clr3        move.l  d0,(a2)+
  74.             dbf     d1,clr3
  75. clr31       move.l  0(a1),a1
  76.             bra.s   clr2
  77. clr4        move.w  #-$4000,$dff09a
  78.             move.l  parmtxt(PC),d0
  79.             bsr     bytedec
  80.             move.l  #clrtxt,d0
  81.             bra     putnam
  82.  
  83. ;find a named node
  84. ;d7 = number of lists to search through
  85. ;a4 = pointer to the first entry in the
  86. ;     list-offset-table
  87. ;a5 = pointer to name
  88. ;returns:
  89. ;d7 = TRUE/FALSE 1/0
  90. ;d0 = node
  91.  
  92. findnam     cmp.b   #'$',0(a5)
  93.             bne.s   fn2
  94.             move.l  d7,d2
  95.             move.l  a5,a0
  96.             bsr     readhex
  97.             tst.b   d7
  98.             beq.s   fn6
  99.             move.l  d2,d7
  100.             bsr     tstnode
  101.             tst.l   d5
  102.             bne.s   fn3
  103.             bra     fn5
  104. fn6         move.l  d2,d7
  105. fn2         move.l  _SysBase(PC),a0
  106.             adda.l  0(a4),a0
  107.             move.l  a5,a1
  108. fn4         CALL    FindName,_SysBase(PC)
  109.             tst.l   d0
  110.             bne.s   fn1
  111.             lea     4(a4),a4
  112.             dbf     d7,fn2
  113. fn5         move.l  #namerr,d0
  114.             bsr     putstr
  115.             move.l  a5,d0
  116.             bsr     putnam
  117.             clr.b   d7
  118.             rts
  119. fn1         move.b  procnum(PC),d2
  120.             beq.s   fn3
  121.             move.l  d0,a0
  122.             cmp.b   143(a0),d2
  123.             bne.s   fn4
  124. fn3         moveq.l #1,d7
  125.             rts
  126.  
  127. ;list-offset-table
  128. TRuNode     dc.l    276
  129. TReNode     dc.l    406
  130. TWaNode     dc.l    420
  131. DevNode     dc.l    350
  132. LibNode     dc.l    378
  133. ResNode     dc.l    336
  134. MemNode     dc.l    322
  135. PorNode     dc.l    392
  136. SemNode     dc.l    532
  137.  
  138. ;Node has been entered in hex. Check if this node exsists
  139. tstnode     move.l  d0,d1
  140.             and.l   #$ff000001,d1
  141.             beq.s   inrange
  142.             move.l  #adrerr,d0
  143.             bsr     putnam
  144.             clr.l   d5
  145.             rts
  146. inrange     movem.l d7/a4,-(a7)
  147.             cmp.l   #TRuNode,a4
  148.             bne.s   inrange1
  149.             move.l  _SysBase(PC),a0
  150.             cmp.l   276(a0),d0
  151.             beq.s   nodefound
  152.             subq    #1,d7
  153.             lea     4(a4),a4
  154. inrange1    move.w  #$4000,$dff09a
  155. getlist     move.l  _SysBase(PC),a0
  156.             add.l   0(a4),a0
  157. nxtnode     tst.l   0(a0)
  158.             beq.s   nxtlist
  159.             cmp.l   a0,d0
  160.             beq.s   nodefound
  161.             move.l  0(a0),a0
  162.             bra.s   nxtnode
  163. nxtlist     lea     4(a4),a4
  164.             dbf     d7,getlist
  165.             move.w  #-$4000,$dff09a
  166.             movem.l d0/d7/a4,-(a7)
  167.             move.l  #noderr,d0
  168.             bsr     putnam
  169.             bsr     readline
  170.             movem.l (a7)+,d0/d7/a4
  171.             or.b    #32,dummy
  172.             cmp.b   #'y',dummy
  173.             beq.s   nodefound1
  174.             clr.l   d5
  175.             movem.l (a7)+,d7/a4
  176.             rts
  177. nodefound   move.w  #-$4000,$dff09a
  178. nodefound1  move.b  #1,d5
  179. etst        movem.l (a7)+,d7/a0
  180.             rts
  181.  
  182. ;clear our window
  183. clearscr    move.l  #cls,d2
  184.             move.l  fileptr,d1
  185.             moveq.l #6,d3
  186.             CALL    Write,dosbase(PC)
  187.             rts
  188. ;allocate FileInfoBlock
  189. allocfinfo  move.l  #260,d0
  190.             clr.l   d1
  191.             CALL    AllocMem,_SysBase(PC)
  192.             move.l  d0,finfoptr
  193.             rts
  194.  
  195. ;free FileInfoBlock
  196. freefinfo   move.l  #260,d0
  197.             move.l  finfoptr,a1
  198.             CALL    FreeMem,_SysBase(PC)
  199.             rts
  200.  
  201. ;Examine ,d0=Lock
  202. getfinfo    move.l  d0,d1
  203.             move.l  finfoptr,d2
  204.             CALL    Examine,dosbase(PC)
  205.             rts
  206.  
  207. ;construct a Pathname from a lock
  208. ;d0=Lock ,resulting string is written to window
  209. getpath     movem.l d1-d7/a0-a6,-(a7)
  210.             move.l  d0,d1
  211.             CALL    DupLock,dosbase(PC)
  212.             lea     out,a4
  213.             clr.b   -(a4)
  214. gp0         tst.l   d0
  215.             beq.s   putall
  216.             move.l  d0,-(a7)
  217.             bsr     getfinfo
  218.             move.l  finfoptr,a0
  219.             move.l  4(a0),d4
  220.             lea     8(a0),a0
  221.             bsr     strlen
  222.             lea     -1(a4),a5
  223.             tst.l   d4
  224.             bmi.s   nodir
  225.             move.b  #'/',-(a4)
  226. nodir       subq    #1,d0
  227.             bmi.s   nofnam
  228. gp1         move.b  0(a0,d0),-(a4)
  229.             dbf     d0,gp1
  230. nofnam      move.l  0(a7),d1
  231.             CALL    ParentDir,dosbase(PC)
  232.             move.l  d0,d4
  233.             move.l  (a7)+,d1
  234.             CALL    UnLock,dosbase(PC)
  235.             move.l  d4,d0
  236.             bra     gp0
  237. putall      cmp.b   #'/',0(a5)
  238.             bne.s   gp2
  239.             move.b  #':',0(a5)
  240. gp2         move.l  a4,d0
  241.             bsr     putnam
  242.             movem.l (a7)+,d1-d7/a0-a6
  243.             rts
  244. strlen      move.l  a0,-(a7)
  245.             move.l  #-1,d0
  246. strl2       addq.l  #1,d0
  247.             tst.b   (a0)+
  248.             bne.s   strl2
  249.             move.l  (a7)+,a0
  250.             rts
  251.  
  252. ;write a title and underline
  253. ;a0 = pointer to text
  254. puthead1    bsr     strlen
  255.             move.l  d0,d5
  256.             move.l  a0,d0
  257.             bra     putstr
  258.  
  259. puthead2    bsr     strlen
  260.             add.l   d0,d5
  261.             bra.s   ph2
  262.  
  263. puthead     bsr     strlen
  264.             move.l  d0,d5
  265. ph2         move.l  a0,d0
  266.             bsr     putnam
  267.             lea     out,a0
  268.             move.l  a0,d0
  269. ph1         move.b  #'-',(a0)+
  270.             dbf     d5,ph1
  271.             move.b  #$9b,(a0)+
  272.             move.b  #'K',(a0)+
  273.             move.b  #$0a,(a0)+
  274.             clr.b   0(a0)
  275.             bra     putstr
  276.  
  277. ;move cursor to a column
  278. ;d0 = current position
  279. ;d1 = column
  280. tab         move.l  a3,-(a7)
  281.             lea     out,a3
  282. sp5         cmp.b   d1,d0
  283.             bcc.s   sp4
  284.             move.b  #' ',0(a3,d0)
  285.             addq.b  #1,d0
  286.             bra.s   sp5
  287. sp4         move.l  d1,ptr
  288.             move.l  (a7)+,a3
  289.             rts
  290.  
  291. ;convert ascii to byte
  292. ;a0 = pointer to text
  293. ;d0 = byte
  294. getnum      cmp.b   #'$',0(a0)
  295.             bne.s   isdec
  296.             bsr     readhex
  297.             move.l  d0,d2
  298.             rts
  299. isdec       clr.w   d2
  300.             clr.w   d3
  301.             clr.b   d6
  302.             clr.b   d7
  303.             cmp.b   #'-',0(a0)
  304.             bne.s   gn1
  305.             lea     1(a0),a0
  306.             moveq.l #1,d6
  307. gn1         move.b  (a0)+,d3
  308.             cmp.b   #'9',d3
  309.             bhi.s   gn2
  310.             cmp.b   #'0',d3
  311.             bcs.s   gn2
  312.             moveq.l #1,d7
  313.             and.b   #$f,d3
  314.             muls    #10,d2
  315.             add.w   d3,d2
  316.             bra.s   gn1
  317. gn2         tst.b   d6
  318.             beq.s   gn3
  319.             neg.w   d2
  320. gn3         tst.b   d7
  321.             bne.s   gn4
  322.             lea     -1(a0),a0
  323. gn4         rts
  324.  
  325. ;convert hex to longword
  326. ;a0 = pointer to text
  327. ;returns d0=value
  328. ;d7 = ok/error 1/0
  329. readhex     movem.l d1-d6/a1-a5,-(a7)
  330.             moveq.b #1,d7
  331.             cmp.b   #'$',0(a0)
  332.             bne.s   rh3
  333.             lea     1(a0),a0
  334. rh3         clr.l   d0
  335.             lea     hextab(pc),a1
  336. rh0         move.b  (a0)+,d3
  337.             moveq.l #15,d2
  338. rh1         cmp.b   0(a1,d2),d3
  339.             beq.s   rh2
  340.             dbf     d2,rh1
  341.             bra     rhend
  342. rh2         lsl.l   #4,d0
  343.             or.b    d2,d0
  344.             bra.s   rh0
  345. rhend       tst.b   d3
  346.             beq.s   rhok
  347.             cmpi.b  #10,d3
  348.             beq.s   rhok
  349.             cmpi.b  #' ',d3
  350.             beq.s   rhok
  351.             clr.l   d7
  352. rhok        movem.l (a7)+,d1-d6/a1-a5
  353.             rts
  354.  
  355. ;skip blanks
  356. ;a0 pointer to text
  357. ; returns a0 = new pointer position
  358. kllblnks    cmpi.b  #' ',0(a0)
  359.             bne.s   gn4
  360.             lea     1(a0),a0
  361.             bra.s   kllblnks
  362.  
  363. ; exit program. If background flag is set, wait for
  364. ; amiga-amiga-x
  365.  
  366. stopall     lea     4(a7),a7
  367.             bra     exitall
  368.  
  369. exit        tst.b   background
  370.             bne     quithold
  371. exitall     move.l  stplist(PC),a3
  372.             tst.l   0(a3)
  373.             beq.s   ex0
  374.             move.l  a3,d0
  375.             bsr     waok
  376.             bra.s   exitall
  377.  
  378. ex0         tst.b   background
  379.             beq.s   ex1
  380.             bsr     removeh
  381.  
  382. ex1         move.l  _SysBase(PC),a1
  383.             move.l  #_LVOSwitch,a0
  384.             move.l  oldswitch,d0
  385.             CALL    SetFunction,_SysBase(PC)
  386.  
  387.             move.l  replyport,-(a7)
  388.             LIBCALL DeletePort
  389.             lea     4(a7),a7
  390.             move.l  fileptr(PC),d1
  391.             CALL    Close,dosbase(PC)
  392.         IFND DEBUG
  393.             CALL    Forbid,_SysBase(PC)
  394.             move.l  wbmsg(PC),d0
  395.             beq.s   todos
  396.             move.l  d0,a1
  397.             CALL    ReplyMsg,_SysBase(PC)
  398.             clr.l   d0
  399.             rts
  400.  
  401. todos       move.l  myseg(PC),d1
  402.             CALL    UnLoadSeg,dosbase(PC)
  403.         ENDC
  404.             clr.l   d1
  405.             CALL    Exit,dosbase(PC)
  406.  
  407. ;print a bcpl-string
  408. ;d0 = bcpl-pointer to bcpl-string
  409. putbcpl     movem.l d3/a0-a1,-(a7)
  410.             tst.l   d0
  411.             beq.s   pb1
  412.             lsl.l   #2,d0
  413.             move.l  d0,a1
  414.             clr.l   d3
  415.             move.b  (a1)+,d3
  416.             move.l  ptr(PC),d0
  417.             lea     out,a0
  418. pb2         move.b  (a1)+,0(a0,d0)
  419.             addq.b  #1,d0
  420.             dbf     d3,pb2
  421.             move.l  d0,ptr
  422. pb1         movem.l (a7)+,d3/a0-a1
  423.             rts
  424.  
  425. ;compare strings
  426. ;a0/a1 = pointers to string
  427. ;returns d0 = true(0) false(1)
  428. strcmp      movem.l a0-a1,-(a7)
  429.             clr.l   d0
  430. src2        move.b  (a0)+,d0
  431.             beq.s   src1
  432.             cmp.b   #10,d0
  433.             beq.s   src1
  434.             cmp.b   (a1)+,d0
  435.             beq.s   src2
  436.             bra.s   src3
  437. src1        move.b  0(a1),d0
  438. src3        movem.l (a7)+,a0-a1
  439.             rts
  440.  
  441. ;compare bcpl string with string
  442. ;a0 = pointer to string
  443. ;a2 = bcpl-pointer to bcpl-string
  444. ;returns d0 = true(0) false(1)
  445. strbcmp     movem.l d1/a0/a2,-(a7)
  446.             clr.l   d0
  447.             clr.l   d1
  448.             adda.l  a2,a2
  449.             adda.l  a2,a2
  450.             move.b  (a2)+,d1
  451.             beq.s   stb1
  452.             subq    #1,d1
  453. stb2        cmp.b   (a2)+,(a0)+
  454.             bne.s   stb1
  455.             dbf     d1,stb2
  456.             moveq   #1,d0
  457. stb1        movem.l (a7)+,d1/a0/a2
  458.             rts
  459.  
  460. ;concat strings
  461. ;a0 = pointer to string
  462. ;a1 = pointer to string to be appended
  463. ;returns d0 = strlen
  464. strcat      movem.l d1/a0-a1,-(a7)
  465.             bsr     strlen
  466.             move.l  d0,d1
  467.             exg     a0,a1
  468.             bsr     strlen
  469.             adda.w  d1,a1
  470. stc1        move.b  (a0)+,(a1)+
  471.             dbf     d0,stc1
  472.             move.l  a1,d0
  473.             movem.l (a7)+,d1/a0-a1
  474.             sub.l   a0,d0
  475.             rts
  476.  
  477. ;convert long to decimal
  478. ;d0 = value
  479. ;d3 bit 0 = left/right justified
  480. ;d3 bit 1 = write/leave
  481. ;returns string in 'buffer'
  482. longdec     movem.l d1-d2/a1-a2,-(a7)
  483.             lea     binarea+8(PC),a1
  484.             move.l  #'    ',-8(a1)
  485.             move.l  #'    ',-4(a1)
  486.             clr.b   0(a1)
  487.             lea     -1(a1),a1
  488.             cmp     #2,d3
  489.             bne.s   ld5
  490.             clr.b   0(a1)
  491. ld5         moveq   #1,d2
  492. ld2         addq    #1,d2
  493.             moveq   #$a,d1
  494.             bsr     div
  495.             addi.l  #$30,d1
  496.             move.b  d1,-(a1)
  497.             tst.l   d0
  498.             bne.s   ld2
  499.  
  500.             btst    #0,d3
  501.             bne.s   ld1
  502.             lea     binarea(PC),a2
  503. ld3         move.b  0(a1),(a2)+
  504.             move.b  #' ',(a1)+
  505.             dbf     d2,ld3
  506. ld1         cmp     #2,d3
  507.             beq.s   ld4
  508.             move.l  #binarea,d0
  509.             bsr     putstr
  510. ld4         movem.l (a7)+,d1-d2/a1-a2
  511.             rts
  512.  
  513. ;write UBYTE
  514. ;d3 = value
  515. bytedec     move.l  #dezimal,d0
  516. pm1         bsr     dec
  517.             bra     putstr
  518.  
  519. ;write signed byte
  520. ;d3 = value
  521. plusmins    move.l  #minus+1,d0
  522.             move.w  #$2020,minus
  523.             tst.b   d3
  524.             bpl.s   pm1
  525.             neg.b   d3
  526.             jsr     dec
  527.             move.b  #'-',-(a3)
  528.             bra.s   putstr
  529.  
  530. dec         move.l  #$20202020,dezimal
  531.             clr.l   d4
  532.             and.l   #$ff,d3
  533.             lea     dezimal+3(PC),a3
  534. bloop       tst.b   d3
  535.             beq.s   bend
  536.             divu    #10,d3
  537.             swap    d3
  538.             ori.b   #48,d3
  539.             move.b  d3,-(a3)
  540.             clr.w   d3
  541.             swap    d3
  542.             bra.s   bloop
  543. bend        cmpa.l  #dezimal+3,a3
  544.             bne     nixfirst
  545.             move.b  #'0',-(a3)
  546. nixfirst    rts
  547.  
  548. ;write a string, move cursor into next line
  549. ;d0 = pointer to text
  550. putnam      bsr     putstr
  551.             tst.b   d0
  552.             beq.s   ncr
  553.             bsr     newline
  554. ncr         rts
  555.  
  556. ;write one char
  557. ;d0 = char
  558. putchar     movem.l d1/a0,-(a7)
  559.             move.l  ptr(PC),d1
  560.             lea     out,a0
  561.             move.b  d0,0(a0,d1)
  562.             add.l   #1,ptr
  563.             movem.l (a7)+,d1/a0
  564.             rts
  565.  
  566. ;write a string, strings are only written when they end with CR
  567. ;d0 = pointer to string
  568. ;returns d0 = cursor position
  569. putstr      movem.l d1-d7/a0-a6,-(a7)
  570.             move.b  #1,printed
  571.             move.l  d0,a2
  572.             lea     out,a3
  573.             move.l  ptr(PC),d0
  574.             cmp.l   #0,a2
  575.             beq     prend
  576. pst1        move.b  (a2)+,d1
  577.             cmpi.b  #13,d1
  578.             beq     pst1
  579.             move.b  d1,0(a3,d0)
  580.             beq     prend
  581.             addq    #1,d0
  582.             cmpi.b  #$0a,d1
  583.             bne.s   pst1
  584.             move.l  d0,d3
  585.             move.l  a3,d2
  586.             move.l  fileptr,d1
  587.             CALL    Write,dosbase(PC)
  588.             clr.l   d0
  589.             tst.b   morefl
  590.             beq.s   pst1
  591.             tst.b   mnflag
  592.             beq.s   pst1
  593.             add.b   #1,row
  594.             move.b  row(PC),d1
  595.             cmp.b   rows,d1
  596.             bne.s   pst1
  597.             move.l  #6,d3
  598.             move.l  fileptr,d1
  599.             move.l  #more,d2
  600.             CALL    Write,dosbase(PC)
  601.             bsr     con
  602.             bsr     readline
  603.             bsr     raw
  604.             clr.b   row
  605.             move.l  #4,d3
  606.             move.l  fileptr,d1
  607.             move.l  #thisline,d2
  608.             CALL    Write,dosbase(PC)
  609.             clr.l   d0
  610.             bra     pst1
  611. prend       move.l  d0,ptr
  612.             movem.l (a7)+,d1-d7/a0-a6
  613.             rts
  614.  
  615. ;Write 8 byte hex value
  616. ;d0 = value
  617. hex8        movem.l d1-d7/a0-a6,-(a7)
  618.             moveq.l #7,d5
  619.             lea     hex8area(PC),a1
  620.             bra     hx1
  621.  
  622. ;Write 6 byte hex value
  623. ;d0 = value
  624. hexa        movem.l d1-d7/a0-a6,-(a7)
  625.             moveq.l #5,d5
  626.             lea     hexarea(PC),a1
  627. hx1         lea     hextab(PC),a0
  628.             clr.l   d2
  629. hexloop     move.b  d0,d2
  630.             and.b   #15,d2
  631.             move.b  0(a0,d2),0(a1,d5)
  632.             lsr.l   #4,d0
  633.             dbf     d5,hexloop
  634.             move.l  a1,d0
  635.             movem.l (a7)+,d1-d7/a0-a6
  636.             bra     putstr
  637.  
  638. ;Convert/write byte into binary string
  639. ;d0 = value
  640. bin         movem.l d1-d7/a0-a6,-(a7)
  641.             moveq.l #7,d4
  642.             lea     binarea(PC),a0
  643. binloop     moveq.l #'0'/2,d1
  644.             roxr.b  #1,d0
  645.             roxl.b  #1,d1
  646.             move.b  d1,0(a0,d4)
  647.             dbf     d4,binloop
  648.             move.l  a0,d0
  649.             movem.l (a7)+,d1-d7/a0-a6
  650.             bra     putstr
  651.  
  652. ;read one line of input string
  653. readline    move.l  fileptr,d1
  654.             move.l  #dummy,d2
  655.             moveq.l #80,d3
  656.             CALL    Read,dosbase(PC)
  657.             rts
  658.  
  659. ;switch console to con: mode & empty input buffer
  660. con         bsr     cmdcon
  661.             move.l  #50,d2
  662.             move.l  fileptr,d1
  663.             CALL    WaitForChar,dosbase(PC)
  664.             beq.s   conend
  665.             bsr     readline
  666. conend      rts
  667.  
  668.  
  669. cmdcon      clr.l   dp_Arg1
  670.             move.l  conmsg,a0
  671.             move.l  #994,dp_Type
  672.             bra.s   cons1
  673.  
  674. ;switch console window to raw mode
  675. raw         move.l  conmsg,a0
  676.             move.l  #994,dp_Type
  677.             move.l  #-1,dp_Arg1
  678.  
  679. ;send a packet
  680. ;a0 = msgport
  681. ;dp_Type and dp_Arg1 have to be inizialized
  682. cons1       movem.l d0-d7/a0-a6,-(a7)
  683.             move.l  #dp_Link,LN_NAME
  684.             move.l  #mypacket,dp_Link
  685.             move.l  replyport,dp_Port
  686.             lea     mypacket,a1
  687.             CALL    PutMsg,_SysBase(PC)
  688.             move.l  replyport,a0
  689.             CALL    WaitPort,_SysBase(PC)
  690.             movem.l (a7)+,d0-d7/a0-a6
  691.             rts
  692.  
  693. ;32-bit division
  694. ;d0 / d1
  695. ;returns d0
  696. div         movem.l d2-d3,-(a7)
  697.             swap    d1
  698.             move.w  d1,d2
  699.             bne.s   div1
  700.             swap    d0
  701.             swap    d1
  702.             swap    d2
  703.             move.w  d0,d2
  704.             beq.s   div2
  705.             divu    d1,d2
  706.             move.w  d2,d0
  707. div2        swap    d0
  708.             move.w  d0,d2
  709.             divu    d1,d2
  710.             move.w  d2,d0
  711.             swap    d2
  712.             move.w  d2,d1
  713.             bra     div8
  714. div1        moveq   #$10,d3
  715.             cmpi.w  #$80,d1
  716.             bcc.s   div3
  717.             rol.l   #8,d1
  718.             subq.w  #8,d3
  719. div3        cmpi.w  #$800,d1
  720.             bcc.s   div4
  721.             rol.l   #4,d1
  722.             subq.w  #4,d3
  723. div4        cmpi.w  #$2000,d1
  724.             bcc.s   div5
  725.             rol.l   #2,d1
  726.             subq.w  #2,d3
  727. div5        tst.w   d1
  728.             bmi.s   div6
  729.             rol.l   #1,d1
  730.             subq.w  #1,d3
  731. div6        move.w  d0,d2
  732.             lsr.l   d3,d0
  733.             swap    d2
  734.             clr.w   d2
  735.             lsr.l   d3,d2
  736.             swap    d3
  737.             divu    d1,d0
  738.             move.w  d0,d3
  739.             move.w  d2,d0
  740.             move.w  d3,d2
  741.             swap    d1
  742.             mulu    d1,d2
  743.             sub.l   d2,d0
  744.             bcc.s   div7
  745.             subq.w  #1,d3
  746.             add.l   d1,d0
  747. div7        moveq   #0,d1
  748.             move.w  d3,d1
  749.             swap    d3
  750.             rol.l   d3,d0
  751.             swap    d0
  752.             exg     d1,d0
  753. div8        movem.l (a7)+,d2-d3
  754.             rts
  755.  
  756. ;install a input-handler
  757. installh    pea     0
  758.             pea     0
  759.             LIBCALL CreatePort
  760.             lea     8(a7),a7
  761.             move.l  d0,InputMsg
  762.             move.l  d0,-(a7)
  763.             LIBCALL CreateStdIO
  764.             lea     4(a7),a7
  765.             move.l  d0,InRequest
  766.             move.l  d0,a1
  767.             lea     devicenam(PC),a0
  768.             clr.l   d0
  769.             clr.l   d1
  770.             CALL    OpenDevice,_SysBase(PC)
  771.             move.l  d0,devstatus
  772.             movea.l InRequest(PC),a1
  773.             move.l  #InInterrupt,40(a1)
  774.             move.w  #9,28(a1)
  775.             CALL    DoIO,_SysBase(PC)
  776.             move.l  d0,iostatus
  777.             move.l  #-1,d0
  778.             CALL    AllocSignal,_SysBase(PC)
  779.             clr.l   d1
  780.             bset    d0,d1
  781.             move.l  d1,mysignal
  782.             rts
  783.  
  784. ;remove handler
  785. removeh     movea.l InRequest(PC),a1
  786.             move.l  #InInterrupt,40(a1)
  787.             move.w  #10,28(a1)
  788.             CALL    DoIO,_SysBase(PC)
  789.             movea.l InRequest(PC),a1
  790.             CALL    CloseDevice,_SysBase(PC)
  791.             move.l  InRequest,-(a7)
  792.             LIBCALL DeleteStdIO
  793.             lea     4(a7),a7
  794.             move.l  InputMsg,-(a7)
  795.             LIBCALL DeletePort
  796.             lea     4(a7),a7
  797.             rts
  798.  
  799. ;this is the handler, it checks if amiga-amiga-x
  800. ;has been pressed and signals it to our task
  801. Keyhandler  tst.b   running
  802.             bne.s   endhandler
  803.             cmp.b   #1,4(a0)
  804.             bne.s   endhandler
  805.             move.w  8(a0),d0
  806.             andi.w  #$c0,d0
  807.             cmpi.w  #$c0,d0
  808.             bne.s   endhandler
  809.             cmp.w   #$32,6(a0)
  810.             bne.s   endhandler
  811. wakeup      move.l  a0,-(a7)
  812.             movea.l mytask(PC),a1
  813.             move.l  mysignal(PC),d0
  814.             CALL    Signal,_SysBase(PC)
  815.             move.l  (a7)+,a0
  816.             clr.b   4(a0)
  817. endhandler  move.l  a0,d0
  818.             rts
  819.  
  820. snoop       bsr     nodenam
  821.             moveq.l #2,d7
  822.             lea     TRuNode(PC),a4
  823.             bsr     findnam
  824.             tst.b   d7
  825.             beq     tm6
  826.             move.l  d0,captask
  827.             pea     0
  828.             pea     memportname
  829.             LIBCALL CreatePort
  830.             lea     8(a7),a7
  831.             move.l  d0,snoopport
  832.             beq     tm6
  833.             lea     snoophead(PC),a0
  834.             bsr     puthead
  835.             move.l  _SysBase(PC),a1
  836.             move.l  -196(a1),oldalloc
  837.             move.l  -208(a1),oldfree
  838.             move.l  #capmalloc,d0
  839.             move.l  #-198,a0
  840.             CALL    SetFunction,_SysBase(PC)
  841.             move.l  _SysBase(PC),a1
  842.             move.l  #capmfree,d0
  843.             move.l  #-210,a0
  844.             CALL    SetFunction,_SysBase(PC)
  845.             clr.b   bool
  846.             clr.b   cbreak
  847. waitmem     move.l  snoopport(PC),a0
  848.             move.l  #$1000,d0
  849.             clr.l   d1
  850.             move.b  15(a0),d1
  851.             bset    d1,d0
  852.             CALL    Wait,_SysBase(PC)
  853.             btst    #12,d0
  854.             beq.s   tm7
  855.             move.b  #1,cbreak
  856. tm7         move.l  mytask(PC),a0
  857.             move.l  snoopport(PC),a0
  858.             CALL    GetMsg,_SysBase(PC)
  859.             tst.l   d0
  860.             bne     tm8
  861.             tst.b   cbreak
  862.             bne     snoopend
  863.             bra     waitmem
  864. tm8         move.l  d0,a3
  865.             move.l  20(a3),d3
  866.             btst    #31,d3
  867.             beq     freed
  868.             move.l  #allok,d0
  869.             bsr     putstr
  870.             lea     memname(PC),a2
  871.             lea     membit(PC),a4
  872.             move.l  #4,d5
  873. tm2         move.l  0(a4),d4
  874.             btst    d4,d3
  875.             beq.s   tm1
  876.             move.l  0(a2),d0
  877.             bsr     putstr
  878. tm1         lea     4(a2),a2
  879.             lea     4(a4),a4
  880.             dbf     d5,tm2
  881.             move.l  #26,d1
  882.             bsr     tab
  883.             move.l  24(a3),d0
  884.             move.l  d0,d3
  885.             bsr     hexa
  886.             move.l  28(a3),d0
  887.             bne.s   tm3
  888.             move.l  #failed,d0
  889.             bsr     putstr
  890.             move.l  #47,d1
  891.             bsr     tab
  892.             bra     tm4
  893. tm3         bsr     hexa
  894.             move.l  28(a3),d0
  895.             add.l   d3,d0
  896.             bsr     hexa
  897.             bra     tm4
  898.  
  899. freed       move.l  #free,d0
  900.             bsr     putstr
  901.             move.b  #'-',d0
  902.             move.l  #18,d1
  903. tm9         bsr     putchar
  904.             dbf     d1,tm9
  905.             move.b  #' ',d0
  906.             bsr     putchar
  907.             move.l  d3,d0
  908.             bsr     hexa
  909.             move.l  24(a3),d0
  910.             bsr     hexa
  911.             move.l  24(a3),d0
  912.             add.l   d3,d0
  913.             bsr     hexa
  914.  
  915. tm4         move.l  32(a3),d0
  916.             bsr     hexa
  917.             bsr     newline
  918.             move.l  #36,d0
  919.             move.l  a3,a1
  920.             CALL    FreeMem,_SysBase(PC)
  921.             bra     tm7
  922.  
  923. snoopend    move.l  _SysBase(PC),a1
  924.             move.l  oldalloc(PC),d0
  925.             move.l  #-198,a0
  926.             CALL    SetFunction,_SysBase(PC)
  927.             move.l  _SysBase(PC),a1
  928.             move.l  oldfree,d0
  929.             move.l  #-210,a0
  930.             CALL    SetFunction,_SysBase(PC)
  931.             move.l  snoopport,-(a7)
  932.             LIBCALL DeletePort
  933.             lea     4(a7),a7
  934. tm6         rts
  935.  
  936. memname     dc.l    memlarg,memclr,memfast,memchip,mempubl
  937. membit      dc.l    17,16,2,1,0
  938.  
  939. capmalloc   movem.l d0-d7/a0-a6,-(a7)
  940.             move.l  _SysBase(PC),a6
  941.             move.l  276(a6),d4
  942.             cmp.l   captask(PC),d4
  943.             bne.s   capm1
  944.             tst.b   bool
  945.             bne     capm1
  946.             move.b  #1,bool
  947.             move.l  d0,d5
  948.             move.l  d1,d6
  949.             bsr     allocmsg
  950.             beq     capm2
  951.             bset    #31,d6
  952.             move.l  d6,20(a1)
  953.             move.l  d5,24(a1)
  954.             move.l  60(a7),32(a1)
  955.             move.l  a1,remembr
  956.             movem.l (a7)+,d0-d7/a0-a6
  957.             bsr     memalloc
  958.             movem.l d0-d7/a0-a6,-(a7)
  959.             move.l  remembr(PC),a1
  960.             move.l  d0,28(a1)
  961.             move.l  snoopport,a0
  962.             move.b  #5,8(a1)
  963.             CALL    PutMsg,_SysBase(PC)
  964.             clr.b   bool
  965.             movem.l (a7)+,d0-d7/a0-a6
  966.             rts
  967. capm2       clr.b   bool
  968. capm1       movem.l (a7)+,d0-d7/a0-a6
  969. memalloc    dc.w    $4ef9
  970. oldalloc    dc.l    0
  971.  
  972. capmfree    movem.l d0-d7/a0-a6,-(a7)
  973.             move.l  _SysBase(PC),a6
  974.             move.l  276(a6),d4
  975.             cmp.l   captask(PC),d4
  976.             bne.s   capf1
  977.             tst.b   bool
  978.             bne.s   capf1
  979.             move.b  #1,bool
  980.             move.l  a1,d5
  981.             move.l  d0,d6
  982.             bsr     allocmsg
  983.             beq.s   capf2
  984.             move.l  d6,20(a1)
  985.             move.l  d5,24(a1)
  986.             move.l  60(a7),32(a1)
  987.             move.l  snoopport,a0
  988.             move.b  #5,8(a1)
  989.             CALL    PutMsg,_SysBase(PC)
  990. capf2       clr.b   bool
  991. capf1       movem.l (a7)+,d0-d7/a0-a6
  992.             dc.w    $4ef9
  993. oldfree     dc.l    0
  994.  
  995. allocmsg    move.l  #36,d0
  996.             move.l  #65536,d1
  997.             bsr     memalloc
  998.             move.l  d0,a1
  999.             tst.l   d0
  1000.             rts
  1001.  
  1002. myswitch    movem.l d0-d1/a0,-(a7)
  1003.             move.l  _SysBase(PC),a0
  1004.             move.l  276(a0),d0
  1005.             move.l  tasksnum(PC),d1
  1006.             lea     cputime,a0
  1007.             subq.l  #1,d1
  1008.             bmi.s   swadd
  1009. sw0         cmp.l   0(a0),d0
  1010.             beq.s   swi1
  1011.             lea     8(a0),a0
  1012.             dbf     d1,sw0
  1013.             bra.s   swadd
  1014. swi1        add.l   #1,4(a0)
  1015. swgo        movem.l (a7)+,d0-d1/a0
  1016.             dc.w    $4ef9
  1017. oldswitch   dc.l    0
  1018. swadd       cmp.l   #50,tasksnum
  1019.             bge.s   swgo
  1020.             add.l   #1,tasksnum
  1021.             move.l  d0,0(a0)
  1022.             move.l  #1,4(a0)
  1023.             bra.s   swgo
  1024.  
  1025. dosbase     dc.l    0
  1026. intuibase   dc.l    0
  1027. gfxbase     dc.l    0
  1028. window      dc.l    0
  1029. parmtxt     dc.l    0
  1030. fileptr     dc.l    0
  1031. conmsg      dc.l    0
  1032. ptr         dc.l    0
  1033. oldidl      dc.l    0
  1034. olddisp     dc.l    0
  1035. myseg       dc.l    0
  1036. mysignal    dc.l    0
  1037. iostatus    dc.l    -1
  1038. devstatus   dc.l    -1
  1039. cancelbit   dc.l    0
  1040. cancelbnum  dc.l    0
  1041. _SysBase    dc.l    0
  1042. InputMsg    dc.l    0
  1043. InRequest   dc.l    0
  1044. startmess   dc.l    0
  1045. savedat     dc.l    0
  1046. mytask      dc.l    0
  1047. wbmsg       dc.l    0
  1048. pointer     dc.l    0
  1049. replyport   dc.l    0
  1050. finfoptr    dc.l    0
  1051. dispatches  dc.l    0
  1052. maxdisp     dc.l    0
  1053. wbaddr      dc.l    0
  1054. remembr     dc.l    0
  1055. remembr2    dc.l    0
  1056. captask     dc.l    0
  1057. snoopport   dc.l    0
  1058. tasksnum    dc.l    0
  1059.  
  1060. stplist     dc.l    lh_tail
  1061. lh_tail     dc.l    0
  1062.             dc.l    stplist
  1063.             dc.b    1
  1064.             dc.b    0
  1065.  
  1066. InInterrupt dc.l    0           ;ln_Succ
  1067.             dc.l    0           ;ln_Pred
  1068.             dc.b    2           ;ln_Type
  1069.             dc.b    60          ;ln_Pri
  1070.             dc.l    0           ;ln_Name
  1071.             dc.l    0           ;is_Data
  1072.             dc.l    Keyhandler  ;is_Code()
  1073.  
  1074. window_l    dc.w    0
  1075. window_t    dc.w    0
  1076. window_w    dc.w    550
  1077. window_h    dc.w    200
  1078.  
  1079. binarea     dc.b    '         ',0
  1080.             EVEN
  1081. minus       dc.b    '  '
  1082. dezimal     dc.b    '   '
  1083. blnk        dc.b    ' ',0
  1084. entries     dc.b    0
  1085. timeout     dc.b    5
  1086. procnum     dc.b    0
  1087. running     dc.b    0
  1088. newpri      dc.b    0
  1089. tasktyp     dc.b    0
  1090. background  dc.b    0
  1091. bool        dc.b    0
  1092. printed     dc.b    0
  1093. cbreak      dc.b    0
  1094. rows        dc.b    0
  1095. row         dc.b    0
  1096. usageflag   dc.b    0
  1097. morefl      dc.b    1
  1098. mnflag      dc.b    1
  1099. tports      dc.b    1
  1100. params      dc.b    'tsdlrempi'
  1101. parmnum     equ     *-params
  1102. t2header    dc.b    '  ID    STATE   SIGALLOC SIGWAIT  SIGRECVD   PC   TASKNAME',0
  1103. theader     dc.b    '  ID    TYPE      STATE    PRI  CPUSE NUM TASKNAME',0
  1104. lheader     dc.b    ' NODE  CNT VER REV  FLAGS   ',0
  1105. libnam      dc.b    'LIBRARY NAME',0
  1106. devnam      dc.b    'DEVICE NAME',0
  1107. resnam      dc.b    'RESOURCE NAME',0
  1108. mheader     dc.b    'LOWER  UPPER   FREE  ATTR  PRI HUNK NAME',0
  1109. nxtline     dc.b    $9b,'K'
  1110. cr          dc.b    10,0
  1111. iheader     dc.b    ' NODE   DATA   CODE   PRI   TYPE     INTERRUPT NAME',0
  1112. rheader     dc.b    ' ADDR   PRI  FLAGS   VER   TYPE    RESIDENT NAME',0
  1113. pheader     dc.b    ' NODE  PORTNAME        FLAGS SIGBT NUM SIGTASK',0
  1114. hunkheader  dc.b    ' BCPL   DATA  LENGTH',0
  1115. ddheader    dc.b    'DEVICE   HDS SECTORS  TRACKS BUFFERS STATE    HANDLER',0
  1116. cdheader    dc.b    'PROCESSNAME    CURRENT DIRECTORY',0
  1117. ofheader    dc.b    ' LOCK  ACCESS  SIZE   PATH/FILENAME',0
  1118. scrheader   dc.b    'NUM  ADDR  TITLE',0
  1119. fohead      dc.b    ' NODE  CNT  Y   X  TYPE  LO  HI NAME',0
  1120. kickhead    dc.b    'START  END    LENGTH',0
  1121. snoophead   dc.b    'ACTION REQUIREMENTS       LENGTH FROM   TO     CALLER',0
  1122. access      dc.b    ' Read  ',0
  1123.             dc.b    ' Write ',0
  1124. romfnt      dc.b    'Rom  ',0
  1125. diskfnt     dc.b    'Disk ',0
  1126. wbname      dc.b    'Workbench',0
  1127. status      dc.b    'Added    ',0
  1128.             dc.b    'Running  ',0
  1129.             dc.b    'Ready    ',0
  1130.             dc.b    'Waiting  ',0
  1131.             dc.b    'Exeption ',0
  1132.             dc.b    'Removed  ',0
  1133.             dc.b    'Freezed  ',0
  1134.             dc.b    'Freezed  ',0
  1135. type        dc.b    'Unknown   ',0
  1136.             dc.b    'Task      ',0
  1137.             dc.b    'Interrupt ',0
  1138.             dc.b    'Device    ',0
  1139.             dc.b    'Msgport   ',0
  1140.             dc.b    'Message   ',0
  1141.             dc.b    'Freemsg   ',0
  1142.             dc.b    'Replymsg  ',0
  1143.             dc.b    'Resource  ',0
  1144.             dc.b    'Library   ',0
  1145.             dc.b    'Memory    ',0
  1146.             dc.b    'Softint   ',0
  1147.             dc.b    'Font      ',0
  1148.             dc.b    'Process   ',0
  1149.             dc.b    'Semaphore ',0
  1150. mp_flags    dc.b    'Signal  ',0
  1151.             dc.b    'Softint ',0
  1152.             dc.b    'Ignore  ',0
  1153. windowname  dc.b    'Xoper V1.2  ) 1988 Werner Gunther',0
  1154. newname     dc.b    '-Xoper-',0
  1155. memportname dc.b    'MemSnoop',0
  1156.  
  1157. cmdnum      set      0
  1158. commds      ADDCMD  'time'
  1159.             ADDCMD  'taskpri'
  1160.             ADDCMD  'info'
  1161.             ADDCMD  'pri'
  1162.             ADDCMD  'flush'
  1163.             ADDCMD  'freeze'
  1164.             ADDCMD  'warm'
  1165.             ADDCMD  'signal'
  1166.             ADDCMD  'break'
  1167.             ADDCMD  'alert'
  1168.             ADDCMD  'lastalert'
  1169.             ADDCMD  'hold'
  1170.             ADDCMD  'exit'
  1171.             ADDCMD  'clear'
  1172.             ADDCMD  'cancel'
  1173.             ADDCMD  'more'
  1174.             ADDCMD  'taskports'
  1175.             ADDCMD  'hunks'
  1176.             ADDCMD  'devices'
  1177.             ADDCMD  'openlib'
  1178.             ADDCMD  'closelib'
  1179.             ADDCMD  'currentdir'
  1180.             ADDCMD  'cd'
  1181.             ADDCMD  'mypri'
  1182.             ADDCMD  'files'
  1183.             ADDCMD  'locks'
  1184.             ADDCMD  'unlock'
  1185.             ADDCMD  'screens'
  1186.             ADDCMD  'windows'
  1187.             ADDCMD  'closescreen'
  1188.             ADDCMD  'closewindow'
  1189.             ADDCMD  'fonts'
  1190.             ADDCMD  'windowfonts'
  1191.             ADDCMD  'lockdrive'
  1192.             ADDCMD  'freedrive'
  1193.             ADDCMD  'capture'
  1194.             ADDCMD  'clrcold'
  1195.             ADDCMD  'clrcool'
  1196.             ADDCMD  'clrwarm'
  1197.             ADDCMD  'snoop'
  1198.             ADDCMD  'usage'
  1199. hex8area    dc.b    '  '
  1200. hexarea     dc.b    '       ',0
  1201. hextab      dc.b    '0123456789abcdef'
  1202. infoh2      dc.b    'Dispatches:',0
  1203. infoh1      dc.b    'CPU:',0
  1204. infoh3      dc.b    'CPU activity: ',0
  1205. infoh6      dc.b    'Total:',0
  1206. infoh4      dc.b    '% ',0
  1207. cpu0        dc.b    '68000',0
  1208. cpu1        dc.b    '68010',0
  1209. cpu2        dc.b    '68020',0
  1210. cpu3        dc.b    '/68881',0
  1211. syst        dc.b    'DF0:',0
  1212. devload     dc.b    'loaded   ',0
  1213. devnload    dc.b    'unloaded ',0
  1214. prompt      dc.b    $9b,'J','->',$9b,$20,$70
  1215. cls         dc.b    $9b,'0 ',$70,$9b,'H'
  1216. getwin      dc.b    $9b,$30,$20,$71
  1217. thisline    dc.b    $9b,$46,$9b,$4b
  1218. notfile     dc.b    '--- ------- ------- ------- ',0
  1219. ganzlongnix dc.b    '-'
  1220. longnix     dc.b    '----'
  1221. nix         dc.b    '--- ',0
  1222. noinfo      dc.b    'No Info on ',0
  1223. namerr      dc.b    'Unable to find ',0
  1224. adrerr      dc.b    'Address Error!',10,0
  1225. noderr      dc.b    'Can`t find this Node. Continue ? (Y/N)',0
  1226. listerr     dc.b    'Unable to find ListHeader. Sort aborted.',0
  1227. noguru      dc.b    'No Alert, shall I produce one ?',0
  1228. gurutxt     dc.b    'Guru Meditation #',0
  1229. clrtxt      dc.b    'Memory Hunks cleared.',0
  1230. canerr0     dc.b    'Process is not a CLI-task',10
  1231.             dc.b    'Has it been started from Workbench ? (Y/N)',10,0
  1232. canerr1     dc.b    'Process was created by CreateProc()',10
  1233.             dc.b    'Shall I UnLoad() ? (Y/N)',10,0
  1234. unloaderr   dc.b    'Arrrgh.. can`t find segments, aborting',0
  1235. noprocs     dc.b    'Not a Process.',0
  1236. notload     dc.b    'No program loaded.',0
  1237. cliprocs    dc.b    'Cli-Process',0
  1238. procloaded  dc.b    'Loaded as a command: ',0
  1239. segloaded   dc.b    'Created by CreateProc()',0
  1240. coldtxt     dc.b    'Cold Capture: ',0
  1241. cooltxt     dc.b    'Cool Capture: ',0
  1242. warmtxt     dc.b    'Warm Capture: ',0
  1243. kicktxt     dc.b    'KickMem     : ',0
  1244. unset       dc.b    'unset',0
  1245. intnames    dc.b    'Serial Out ',0
  1246.             dc.b    'Disk Block ',0
  1247.             dc.b    'SoftInt    ',0
  1248.             dc.b    'CIAA       ',0
  1249.             dc.b    'Copper     ',0
  1250.             dc.b    'VBeam      ',0
  1251.             dc.b    'Blitter    ',0
  1252.             dc.b    'Audio Ch.0 ',0
  1253.             dc.b    'Audio Ch.1 ',0
  1254.             dc.b    'Audio Ch.2 ',0
  1255.             dc.b    'Audio Ch.3 ',0
  1256.             dc.b    'Serial In  ',0
  1257.             dc.b    'Disk Sync  ',0
  1258.             dc.b    'CIAB       ',0
  1259.             dc.b    'SoftInt    ',0
  1260.             dc.b    'NMI        ',0
  1261. inttyp      dc.b    0,0,1,1,1,1,0,0,0,0,0,0,0,1,1,1
  1262. devicenam   dc.b    'input.device',0
  1263. memlarg     dc.b    'LARGEST ',0
  1264. memclr      dc.b    'CLEAR ',0
  1265. memfast     dc.b    'FAST ',0
  1266. memchip     dc.b    'CHIP ',0
  1267. mempubl     dc.b    'PUBLIC ',0
  1268. failed      dc.b    'Failed !',0
  1269. allok       dc.b    'ALLOC: ',0
  1270. free        dc.b    'FREE: ',0
  1271.  
  1272. synerr      dc.b    'Syntax Error, type "?" for help',10,0
  1273. more        dc.b    '<MORE>'
  1274. waittxt     dc.b    '<RETURN>',$9b,$4a
  1275. wberr       dc.b    'Can`t examine Workbench locks',0
  1276. dnotf       dc.b    'Directory not found',0
  1277. notdir      dc.b    'Not a directory',0
  1278. nomount     dc.b    ' not mounted.',0
  1279. dishelp     dc.b    10,'Names are case sensitive and followd by a ":"',0
  1280. unlerr      dc.b    'Lock not found',0
  1281. unl1        dc.b    'Lock is on ',0
  1282. unltxt      dc.b    'Old lock was: ',0
  1283. unltxt2     dc.b    'Unlock ? (Y/N)',10,0
  1284. scnofound   dc.b    'Screen not found.',0
  1285. winnofound  dc.b    'Window not found.',0
  1286. stperr      dc.b    'Task must be "READY" or "WAITING"',10,0
  1287. waerr       dc.b    'Task must be "FREEZED"',10,0
  1288. onscr       dc.b    'On Screen: ',0
  1289. usetxt      dc.b    $9b,'1mUSAGE:',$9b,'0m Xoper [T] [S] [L] [D] [R] [E] [M] [P] [I]',$9b,'K',10
  1290.             dc.b    'OR     Xoper -b',$9b,'K',10
  1291.             dc.b    $9b,'1mDISPLAY:',$9b,'0m',$9b,'K',10
  1292.             dc.b    '[T]asks [S]=taskstate [L]ibraries [D]evices [R]esources',$9b,'K',10
  1293.             dc.b    'r[E]sident [M]emory [P]orts [I]nterrupts [Q]uit',$9b,'K',10
  1294.             dc.b    $9b,'1mCOMMANDS:',$9b,'0m',$9b,'K',10
  1295.             dc.b    'Time         <secs>',$9b,'K',10
  1296.             dc.b    'Taskpri      <priority>  [processnum] <taskname>',$9b,'K',10
  1297.             dc.b    'Mypri        <priority>',$9b,'K',10
  1298.             dc.b    'Signal       <mask(hex)> [processnum] <taskname>',$9b,'K',10
  1299.             dc.b    'Break        [processnum] <taskname>',$9b,'K',10
  1300.             dc.b    'Freeze|Warm  [processnum] <taskname>',$9b,'K',10
  1301.             dc.b    'Cancel       [processnum] <taskname>',$9b,'K',10
  1302.             dc.b    'Snoop        [processnum] <taskname>',$9b,'K',10
  1303.             dc.b    'Pri          <priority> <nodename>',$9b,'K',10
  1304.             dc.b    'Info         <name>',$9b,'K',10
  1305.             dc.b    'Clear        <longword(hex)>',$9b,'K',10
  1306.             dc.b    'Hunks        [processnum] <procname>',$9b,'K',10
  1307.             dc.b    'CD           <directory> [processnum] <procname>',$9b,'K',10
  1308.             dc.b    'Unlock       <lock>',$9b,'K',10
  1309.             dc.b    'Openlib    | Closelib <libraryname>',$9b,'K',10
  1310.             dc.b    'Closewindow| Closescreen <title>',$9b,'K',10
  1311.             dc.b    'Lockdrive  | Freedrive   <DFn:>',$9b,'K',10
  1312.             dc.b    'Flush,Devices,Currentdir,Files,Locks,Lastalert,More',$9b,'K',10
  1313.             dc.b    'Taskports,Windows,Screens,Fonts,Windowfonts,Capture',$9b,'K',10
  1314.             dc.b    'ClrCool,ClrCold,ClrWarm,Usage,Hold,Exit',$9b,'K',10
  1315. null        dc.b    0
  1316.  
  1317.     IFD DEBUG
  1318. dosname     dc.b    'dos.library',0
  1319. intuiname   dc.b    'intuition.library',0
  1320. gfxname     dc.b    'graphics.library',0
  1321.             EVEN
  1322.     ENDC
  1323.  
  1324.             BSS     blabla
  1325. buffer      ds.b    256
  1326. fname       ds.b    284
  1327. out         ds.b    80
  1328. dummy       ds.b    80
  1329. in          ds.b    80
  1330. cputime     ds.b    400
  1331.  
  1332. mypacket    BSS     standardpacket
  1333.  
  1334. LN_SUCC     ds.l    1
  1335. LN_PRED     ds.l    1
  1336. LN_TYPE     ds.b    1
  1337. LN_PRI      ds.b    1
  1338. LN_NAME     ds.l    1
  1339. MP_FLAGS    ds.b    1
  1340. MP_SIGBIT   ds.b    1
  1341. MP_SIGTASK  ds.l    1
  1342. MN_SIZE     ds.w    1
  1343. LH_HEAD     ds.l    1
  1344. LH_TAIL     ds.l    1
  1345. LH_TAILPRED ds.l    1
  1346. LH_TYPE     ds.b    1
  1347. LH_pad      ds.b    1
  1348. dp_Link     ds.l    1
  1349. dp_Port     ds.l    1
  1350. dp_Type     ds.l    1
  1351. dp_Res1     ds.l    1
  1352. dp_Res2     ds.l    1
  1353. dp_Arg1     ds.l    1
  1354. dp_Arg2     ds.l    1
  1355. dp_Arg3     ds.l    1
  1356. dp_Arg4     ds.l    1
  1357. dp_Arg5     ds.l    1
  1358. dp_Arg6     ds.l    1
  1359. dp_Arg7     ds.l    1
  1360.             END
  1361.  
  1362. \Rogue\Monster\
  1363. else
  1364.   echo "will not over write Xoper.a2"
  1365. fi
  1366. if [ `wc -c Xoper.a2 | awk '{printf $1}'` -ne 38075 ]
  1367. then
  1368. echo `wc -c Xoper.a2 | awk '{print "Got " $1 ", Expected " 38075}'`
  1369. fi
  1370. if `test ! -s Xoper.doc`
  1371. then
  1372. echo "writing Xoper.doc"
  1373. cat > Xoper.doc << '\Rogue\Monster\'
  1374.                                  Xoper V1.0
  1375.  
  1376.                     Copyright (c) Werner Gunther 1988
  1377.  
  1378. Xoper is a freeware program to display and to control system activity.
  1379. Permition is granted to freely distribute this program.
  1380.  
  1381. --------------------------------------------------------------------------
  1382. Changes in V1.2:
  1383. New commands: Snoop, Capture, ClrCool, ClrWarm, ClrCold.
  1384. Added       : CPU usage by task.
  1385.  
  1386. Cancel command has been rewritten, some minor bugs removed.
  1387. -------------------------------------------------------------------------
  1388.  
  1389. Starting Xoper from CLI:
  1390.  
  1391. Xoper [T] [S] [L] [D] [R] [E] [M] [P] [I]
  1392.  
  1393. These parameters are decribed below. For all those who like long
  1394. Startup-Sequences, overcrowded memory and hot-keys enter
  1395.  
  1396. Xoper -b
  1397.  
  1398. This will install Xoper in background waiting for LeftAmiga-RightAmiga-X
  1399. to pop up. In both cases you don't have to RUN or RUNBACK Xoper, it will
  1400. always create its own process.
  1401.  
  1402. Xoper Commands:
  1403. ---------------
  1404.  
  1405.  Commands can be entered after the prompt '->', these are divided into two
  1406. groups:
  1407.  
  1408. Display commands: These are always single character entries and may be
  1409. specified in any order, upper or lower case, with or w/o enbedded blanks,
  1410. after the prompt or from CLI as parameters:
  1411.  
  1412. T = Tasks (Default if Xoper is called without parameters)
  1413. Task node (HEX), Display type, status, priority (decimal), CPU usage
  1414. (percent), processnumber for Dos-Processes (decimal), taskname.
  1415.  
  1416. S = Task Signals
  1417. Task node (HEX), Allocated Signals (HEX), Signals the Task is waiting for
  1418. (HEX), Signals received (HEX), Address of the next instruction to be
  1419. executed (HEX).
  1420.  
  1421. L = Libraries
  1422. Base address (HEX), open count (decimal), version (decimal), revision
  1423. (decimal), flags (binary), libraryname.
  1424.  
  1425. D = Devices
  1426. Base address (HEX), open count (decimal), version (decimal), revision
  1427. (decimal), flags (binary), devicename.
  1428.  
  1429. R = Resident
  1430. Base address (HEX), priority (decimal), flags (binary), version
  1431. (decimal), type, name.
  1432.  
  1433. E = Resources (sorry)
  1434. Base address (HEX), open count (decimal), version (decimal), revision
  1435. (decimal), flags (binary), resource name.
  1436.  
  1437. M = Memory
  1438. Lower and upper bounds (HEX), bytes free (decimal), attributes, priority
  1439. (decimal), hunk name.
  1440.  
  1441. P = Ports
  1442. Node address (HEX), portname, flags, signal bit (decimal), queue length
  1443. [number of messages] (decimal), taskname.
  1444.  
  1445. I = Interrupts
  1446. Node address (HEX), pointer to interrupt data (HEX), pointer to interrupt
  1447. code (HEX), priority (decimal),type [interupt queue the interrupt belongs
  1448. to], interrupt name.
  1449.  
  1450. H = Help ( or ?)
  1451. Show a list of commands.
  1452.  
  1453. Q = Quit
  1454. Same as QUIT (see below).
  1455.  
  1456. Example: Entering TPM would display Tasks, Ports and Memory. The display
  1457. would be updated after a few seconds (5 by default, may be changed
  1458. anytime, see below.)
  1459.  
  1460. Other commands that do not display lists:
  1461. These commands may be entered upper or lower case. Parameters enclosed
  1462. in '<>' must be, enclosed in '[]' may be specified. Names are usualy
  1463. entered as ascii-strings, it can however happen that two or more nodes of
  1464. the same name exist. On tasks you may specify the DOS-Processnumber to
  1465. sort them out. If everything fails, you can enter the Node-Address with a
  1466. leading '$'. This Address will be checked first before the command is being
  1467. executed. If the check fails, you'll get an error message or a warning or
  1468. a prompt, depending on what went wrong. Names are always the last parameter
  1469. to enter. This may seem strange, but it is the simplest way to get rid of
  1470. enbedded blanks.
  1471.  
  1472. Time <seconds>
  1473. Set time between updates. Minimum is 1 second, maximum is 255, default is 5
  1474. seconds.
  1475. Example: Time 1
  1476.  
  1477. Taskpri <priority> [processnumber] <taskname>
  1478. Change the priority of a task. Values may range from -127 to 127, better
  1479. use values between -5 and 5.
  1480. Example: Taskpri 5 New Cli
  1481.  
  1482. Mypri <priority>
  1483. Shortcut for "Taskpri Xoper <priority>"
  1484. Example: Mypri 6
  1485.  
  1486. Pri <priority> <nodename>
  1487. Change the priority of any other node. This commad does not work for Tasks.
  1488. If the specified node has been found, the entire list the node belongs to
  1489. will be resorted.
  1490. Example: Pri 1 Chip Memory        (try to allocate memory in CHIP first)
  1491.  
  1492. Break [processnumber] <taskname>
  1493. Set break signals. Useful for tasks running in background or from Workbench.
  1494. Example: Break 3 New CLI
  1495.  
  1496. Hunks [processnumber] <processname>
  1497. Show location, BCPL-Pointers and length of memory blocks the process uses.
  1498. Example: Hunks RAM
  1499.  
  1500. Snoop [processnumber] <taskname>
  1501. Track memory allocation/deallocation of a task. Press break (CTRL-C) to
  1502. stop. List includes: action (alloc/free), memory requirents (CHIP/ FAST/
  1503. PUBLIC etc), memory size, memory location (start, end) and the address from
  1504. where AllocMem() was called.
  1505.  
  1506. Files
  1507. List lock, access, size and name of open files.
  1508.  
  1509. Locks
  1510. List any lock.
  1511. BUG: Trying to lock the Volume "RAM Disk" crashes the machine sometimes. If
  1512. a Volume "RAM Disk" is found it will be replaced by the devicename "RAM:"
  1513. (this has been fixed on WB 1.3). Make sure you don't have a disk labeled
  1514. "RAM Disk" or you'll never see its locks:-)
  1515.  
  1516. Currentdir
  1517. List current directory settings of all processes.
  1518.  
  1519. Devices
  1520. List name,heads,sectors,tracks,startup-buffers and handler-process of every
  1521. DOS-device.
  1522.  
  1523. Capture
  1524. Show vectors controling the reset, i.e. CoolCapture, ColdCapture and
  1525. WarmCapture pointers, KickMem allocations. Useful when searching
  1526. for Viruses, but remember that the RAD: device in 1.3 uses the KickMem
  1527. pointer to recover from a reset.
  1528.  
  1529. ClrCool
  1530. ClrCold
  1531. ClrWarm
  1532. Clear one of those pointers.
  1533.  
  1534. Lockdrive <drivename:>
  1535. Prevent DOS, Workbench and Disk-Validator from cluttering on the drive.
  1536. This command isn't very useful, but I needed it myself. Please note that
  1537. the drivename is case sensitive and has to end with a ':'.
  1538.  
  1539. Freedrive <drivename:>
  1540. Re-enable a drive.
  1541.  
  1542. Windows
  1543. List address and title of all windows.
  1544.  
  1545. Screens
  1546. List address and title of screens.
  1547.  
  1548. Fonts
  1549. List address,height,width,type,fist character and last character of all
  1550. loaded fonts.
  1551.  
  1552. Windowfonts
  1553. List Windows and associated fonts.
  1554.  
  1555. Freeze [processnumber] <taskname>
  1556. Halt a Task. The task should be READY or WAITING. Frozen tasks are queued in
  1557. a new list called FREEZED. When you leave Xoper, halted Task will be
  1558. released.
  1559. Example: Freeze Killer Graphics Task
  1560.  
  1561. Warm [processnum] <taskname>
  1562. Restart a halted Task. Task must be FREEZED.
  1563. Example: Warm Killer Graphics Task
  1564.  
  1565. Info <librarynode | devicenode>
  1566. Show additional information stored in the lib_IdString field.
  1567. Example: Info arp.library
  1568.  
  1569. Openlib <libraryname>
  1570. Open a library. This is useful if you don't want a specified library being
  1571. 'flushed' out.
  1572. Example: Openlibrary arp.library
  1573.  
  1574. Clear [longword]
  1575. Fill unused memory chunks with pattern, default is 0. Handy for debuggers.
  1576. Example: Clear $66726565
  1577.  
  1578. Flush
  1579. Clean up memory, flush unused libraries, devices and fonts.
  1580.  
  1581. Lastalert
  1582. Show last Guru Meditation code or rubbish.
  1583.  
  1584. Usage
  1585. Toggle CPUSE field on the task display between usage relative to all
  1586. possible dispatches and usage relative to actually dispatched tasks.
  1587. Ahem...not very clear I think. Well, let me try again...
  1588. If you add all CPUSE fields together you get 100 % (more or less 1%). After
  1589. entering "Usage" adding the fields together will give you the same value as
  1590. shown in the 'CPU Activity field'. (I HATE having to write docs)
  1591.  
  1592. Taskports
  1593. Disable / enable a listing of taskports if ports are displayed.
  1594.  
  1595. More
  1596. Stop displaying "<MORE>" and "<RETURN>" if output exceeds window.
  1597.  
  1598. Quit or just Q
  1599. Exit Xoper. If Xoper was started with '-b' or if 'Hold' was specified it
  1600. will stay in background waiting for LeftAmiga-RightAmiga-X.
  1601.  
  1602. Hold
  1603. Exit Xoper but install a key-handler and stay in background. Window
  1604. settings and display commands are saved.
  1605.  
  1606. Exit
  1607. Clean up and quit.
  1608.  
  1609. !!!! WARNING: The next few commands are dangerous and 'dirty' !!!!!
  1610. !!!!!!!!!!!! don't use them if not strictly necessary !!!!!!!!!!!!!
  1611.  
  1612. Cancel [processnumber] <taskname>
  1613. Cancel a task or a process. If the task has been called from CLI, the Task
  1614. itself and the CLI will be killed. Hunks, Windows, Screens  and the
  1615. teminal-window will be freed. Simple tasks are just RemTask()'ed. If it is
  1616. not a CLI Task you'll be asked if it is a Workbench task, if the answer is
  1617. 'Yes' unloading will be done by the Workbench. If not, you will be prompted
  1618. if Xoper should unload the code. Enter 'No' if you don't know how the task
  1619. has been started.
  1620.  
  1621. Closewindow <title>
  1622. Closes a Window. Please, use it only if the corresponding Task has been
  1623. 'Cancel'ed. Use the Window-Structure address if the window has no name.
  1624.  
  1625. Closescreen <title>
  1626. same as above, but for screens.
  1627.  
  1628. Unlock <lock (BPTR)>
  1629. Unlock a file.
  1630.  
  1631. Closelib <libraryname>
  1632. This is exactly the same as CloseLibrary().
  1633.  
  1634. CD [processnumber] <processname>
  1635. Change the current directory of a process. You are prompted if the old
  1636. directory lock should be unlocked.
  1637.  
  1638. Signal <mask> [processnumber] <taskname>
  1639. Set any task-signal. Mask is a hexadecimal value with or w/o leading '$'.
  1640. See task's SIGWAIT field for sensible values. Tasks normaly do not wait for
  1641. signals only, but for messages, that's why this command may not have the
  1642. desired effect, but it is quite useful for tasks hanging around and waiting
  1643. for events that may never happen. Warning: Using Signal without any
  1644. knowledge about what you are going to signal may cause a system-crash!
  1645. Example: Signal 10000000 PopCLI III
  1646.  
  1647. ----------------------------------------------------------------------------
  1648.  
  1649. Please send flames, bug reports and especially a list of features you would
  1650. like to have included in the next version to
  1651.  
  1652.  Werner Gunther
  1653.  Wingertspfad 12
  1654.  D 6900 Heidelberg
  1655.  (Germany)
  1656.  
  1657. or to my EMAIL address for a fast response:
  1658.  
  1659.  G35@DHDURZ1.BITNET
  1660.  
  1661.  
  1662. \Rogue\Monster\
  1663. else
  1664.   echo "will not over write Xoper.doc"
  1665. fi
  1666. if [ `wc -c Xoper.doc | awk '{printf $1}'` -ne 9600 ]
  1667. then
  1668. echo `wc -c Xoper.doc | awk '{print "Got " $1 ", Expected " 9600}'`
  1669. fi
  1670. echo "Finished archive 1 of 2"
  1671. # if you want to concatenate archives, remove anything after this line
  1672. exit
  1673. -- 
  1674. Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
  1675. Have five nice days.
  1676.